import { Component, OnInit } from '@angular/core';
import { ApiService } from '../api/api.service';
import { ApiUrl } from '../api/ApiUrl';
import { AnswerVO } from '../vo/Answervo';
@Component({
  selector: 'app-connectcount',
  templateUrl: './connectcount.page.html',
  styleUrls: ['./connectcount.page.scss'],
})
export class ConnectcountPage implements OnInit {
  successtimes: number;
  doingtimes: number;
  item: AnswerVO;
  constructor(public api: ApiService) { }

  ngOnInit() {
    this.onSearch();
  }
  onSearch() {
    this.api.getItem<AnswerVO>(ApiUrl.getConnectCount, {}).subscribe(response => {

      if (response === null ) {
        console.log('没有数据返回');
        return;
      }
      this.item = response;
      console.log(this.item.data);
      this.successtimes = this.item.data[0];
      this.doingtimes = this.item.data[1];
    }, () => {

      console.log('出错了');
    });
  }
}
